package ${package.Controller};

import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.xinxin.mall.common.pojo.CommonResult;
import ${package.Service}.${table.serviceName};
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
<#if restControllerStyle>
import org.springframework.web.bind.annotation.RestController;
<#else>
import org.springframework.stereotype.Controller;
</#if>
<#if superControllerClassPackage??>
import ${superControllerClassPackage};
</#if>

import javax.annotation.Resource;
/**
 * <p>
 * ${table.comment!} 前端控制器
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
@ApiSupport(author = "${author}")
@Tag(name = "${table.comment!} - Admin", description = "${table.comment!} 前端控制器")
<#if restControllerStyle>
@RestController
<#else>
@Controller
</#if>
@RequestMapping("/admin<#if package.ModuleName?? && package.ModuleName != "">/${package.ModuleName}</#if>/<#if controllerMappingHyphenStyle>${controllerMappingHyphen}<#else>${baseControllerPath}</#if>")
<#if kotlin>
class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}()</#if>
<#else>
<#if superControllerClass??>
public class ${table.controllerName} extends ${superControllerClass} {
<#else>
public class ${table.controllerName} {
</#if>
    @Resource
    private ${table.serviceName} ${table.serviceName?lowerCase};

    @GetMapping("/get-test")
    @Operation(summary = "获取${table.comment!}", description = "根据主键id获取${table.comment!}详情")
    public CommonResult get${table.name?upperCase}(
            @Schema(description = "主键id", defaultValue = "1") @RequestParam(value = "id", required = true) Long id) {
        return CommonResult.success(${table.serviceName?lowerCase}.getById(id));
    }
}
</#if>
